﻿<%@ Page Language="C#" MasterPageFile="/e/General.Master" AutoEventWireup="true" CodeBehind="register.aspx.cs"
    Inherits="BaoJian.e.register" Title="昭光健康网--用户注册" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        @import url("../css/login-register.css");
        @import url("../css/your-account/your-account.css");
    </style>

    <script language="JavaScript">
<!--

var haveCheckedEmail = false;
var haveCheckedPassword = false;

var userFinalEmail;
var userFinalPassword;

function isValidEmail(inEmail)
{
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(inEmail)) return true;
	else return false;
}

function isValidPassword(inPassword)
{
	var filter = /^([a-zA-Z0-9]{6,20})$/;
	if (filter.test(inPassword)) return true;
	else return false;
}

function checkEmail()
{
	var email = document.aspnetForm.ctl00_ContentPlaceHolder1_userName.value;   
	if (email != "") {
		userFinalEmail = email;
		if (!isValidEmail(email)) {
			setUsernamePromptText("您填写的电子邮件地址, 可能不是一个有效的邮件地址，请检查后重新提交。", true);
			haveCheckedEmail = true;
		}
		else if (email.length > 60) {
			setUsernamePromptText("您输入的电子邮件地址长度超过允许范围，请检查后重新提交。", true);
			haveCheckedEmail = true;
		}
		else {
			if (haveCheckedEmail) {
				setUsernamePromptText("请填写有效的Emai地址作为下次登录的用户名，同时我们也会给这个地址发送帐户信息、订单通知等。", false);
			}
			haveCheckedEmail = false;
		}
	}
	
}

function checkEmail2()
{  
	var email2 = document.aspnetForm.ctl00_ContentPlaceHolder1_repeatUserName.value;

	if (email2!= "") {
		if (!isValidEmail(userFinalEmail)) return;
		if (email2.length > 60) {
			setUsernamePromptText("您输入的电子邮件地址长度超过允许范围，请检查后重新提交。", true);
		}
		else if (email2 == userFinalEmail) {
			setUsernamePromptText("您的新用户名是: <b>" + document.aspnetForm.ctl00_ContentPlaceHolder1_userName.value + "</b>", false);
		} else {
			setUsernamePromptText("您两次输入的E-mail地址不一致，请重新输入。", true);
		}
	}
	
}

function checkPassword()
{
	var password = document.aspnetForm.ctl00_ContentPlaceHolder1_passWord.value;
	if (password != "") {
		userFinalPassword = password;
		if (!isValidPassword(password)) {
			setPasswordPromptText("请确认密码符合基本规则：由英文字母(A-Z)，阿拉伯数字组成(0-9)，并且密码长度不能少于6个字符。", true);
			haveCheckedPassword = true;
		} else {
			if (haveCheckedPassword) {
				setPasswordPromptText("密码由英文字母(A-Z)，阿拉伯数字组成(0-9)，并且密码长度不能少于6个字符。", false);
			}
			haveCheckedPassword = false;
		}
	}
	
}

function checkPassword2()
{
	var password2 = document.aspnetForm.ctl00_ContentPlaceHolder1_validatePwd.value;
	if (password2 != "") {
		if (!isValidPassword(userFinalPassword)) return;
		if (password2 == userFinalPassword) {
			setPasswordPromptText("您设置的密码验证通过。", false);
		} else {
			setPasswordPromptText("您输入两次的密码不同，请再次检查。", true);
		}
	}
	
}

function checkFriendlyName()
{
   
	var friendlyName = document.aspnetForm.ctl00_ContentPlaceHolder1_nickName.value;
	
	if (friendlyName.length <= 0)
	{
		setFriendlyNamePromptText("请您输入您的姓名！", true);		
	} 
	else if (friendlyName.length > 32) {
		setFriendlyNamePromptText("姓名的长度不能超过32个字符！", true);
	} 
	else
	{	
		setFriendlyNamePromptText("您的姓名是: <b>" + document.aspnetForm.ctl00_ContentPlaceHolder1_nickName.value + "</b>", false);
	}
}

function setFriendlyNamePromptText(inText,errorFlag)
{
	if (errorFlag) {
		var msgText = "<table width='100%' border='0' cellspacing='1' cellpadding='1'><tr>" +
                   "<td bgcolor='#FFFFFF'><table width='100%' border='0' cellspacing='4' cellpadding='0' bgcolor='#FFFFFF'>" +
                   "<tr><td width='17' valign='top'><img src='https://ssl-images.amazon.cn/a/az-exclamation-error-red.gif' width='17' height='17' /></td>" +
                   "<td><span class='font-error-2'>" + inText + "</span></td></tr>" +
                   "</table></td></tr></table></td></tr>";
	}
	else{
		var msgText = "<table width='100%'  border='0' cellspacing='1' cellpadding='1'><tr>" +
                      "<td bgcolor='#FFFFFF'><table width='100%' border='0' cellspacing='4' cellpadding='0' bgcolor='#FFFFFF'>" +
                      "<tr><td>&nbsp;</td><td><span class='font-success2'>" + inText + "</span></td>" +
                      "</tr></table></td></tr></table>";
                 						
	}
	setElementText("friendlyNamePrompt", msgText);
}

function setUsernamePromptText(inText,errorFlag)
{
	if (errorFlag) {
		var msgText = "<table width='100%' border='0' cellspacing='1' cellpadding='1'><tr>" +
                   "<td bgcolor='#FFFFFF'><table width='100%' border='0' cellspacing='4' cellpadding='0' bgcolor='#FFFFFF'>" +
                   "<tr valign='top'><td width='17'><img src='https://ssl-images.amazon.cn/a/az-exclamation-error-red.gif' width='17' height='17' /></td>" +
                   "<td><span class='font-error-2'>" + inText + "</span></td></tr>" +
                   "</table></td></tr></table></td></tr>";
	}
	else{
		var msgText = "<table width='100%'  border='0' cellspacing='1' cellpadding='1'><tr>" +
                      "<td bgcolor='#FFFFFF'><table width='100%' border='0' cellspacing='4' cellpadding='0' bgcolor='#FFFFFF'>" +
                      "<tr><td>&nbsp;</td><td><span class='font-success2'>" + inText + "</span></td>" +
                      "</tr></table></td></tr></table>";						
	}
	
	setElementText("usernamePrompt", msgText);
}

function setPasswordPromptText(inText,errorFlag)
{
	if (errorFlag) {
		var msgText = "<table width='100%' border='0' cellspacing='1' cellpadding='1'><tr>" +
                   "<td bgcolor='#FFFFFF'><table width='100%' border='0' cellspacing='4' cellpadding='0' bgcolor='#FFFFFF'>" +
                   "<tr valign='top'><td width='17'><img src='https://ssl-images.amazon.cn/a/az-exclamation-error-red.gif' width='17' height='17' /></td>" +
                   "<td><span class='font-error-2'>" + inText + "</span></td></tr>" +
                   "</table></td></tr></table></td></tr>";
	}
	else{
		var msgText = "<table width='100%'  border='0' cellspacing='1' cellpadding='1'><tr>" +
                      "<td bgcolor='#FFFFFF'><table width='100%' border='0' cellspacing='4' cellpadding='0' bgcolor='#FFFFFF'>" +
                      "<tr><td>&nbsp;</td><td><span class='font-success2'>" + inText + "</span></td>" +
                      "</tr></table></td></tr></table>";						
	}
	
	setElementText("passwordPrompt", msgText);
}


function setElementText(elementId,inText)
{
	document.getElementById(elementId).innerHTML=inText;
}

-->
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <!--this is content start-->
    <br>
    &nbsp;<br>
    <table width="85%" align="center" border="0" cellpadding="0" cellspacing="0">
        <tbody>
            <tr>
                <td colspan="4" valign="top" width="99%">
                    <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0">
                        <tbody>
                            <tr>
                                <td valign="top" width="10" align="left" bgcolor="#ddddcc">
                                    <img src="../images/az-tan-top-left-round-corner.gif" width="10" border="0"
                                        height="28">
                                </td>
                                <td valign="bottom" width="20%" bgcolor="#ddddcc" height="28" nowrap="nowrap">
                                    <span class="title">注册新用户&nbsp;&nbsp;</span>
                                </td>
                                <td valign="bottom" width="79%" align="right" bgcolor="#ddddcc">
                                    &nbsp;
                                </td>
                                <td valign="top" width="10" align="right" bgcolor="#ddddcc">
                                    <img src="../images/az-tan-top-right-round-corner.gif" width="10" border="0"
                                        height="28">
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
        </tbody>
    </table>
    <table id="" width="85%" align="center" bgcolor="#ddddcc" border="0" cellpadding="0"
        cellspacing="0">
        <tbody>
            <tr bgcolor="#ddddcc">
                <td valign="top" bgcolor="#ddddcc">
                    <table width="100%" align="center" bgcolor="#ddddcc" border="0" cellpadding="0" cellspacing="3">
                        <tbody> <tr><td valign="top" bgcolor="#ffffff"><table width="100%" align="center" border="0" cellpadding="5" cellspacing="0">
                                        <tbody><tr>
                                                <td>                                                   
                                                    <table width="100%" align="center" border="0" cellpadding="0" cellspacing="3">
                                                        <tbody>
                                                            <tr>
                                                                <td valign="top" height="118">
                                                                <table width="100%" border="0" cellpadding="1" cellspacing="10">
                                                                        <tbody>
                                                                            <tr>
                                                                                <td class="important" colspan="5">
                                                                                    注册新帐户方便又容易
                                                                                </td>
                                                                            </tr>
                                                                            <!-- Begin to write input paramaters here -->                                                                            
                                                                            <input name="uid" value="168-2712428-1468206" type="hidden">
                                                                            <!-- Write input paramaters here over -->
                                                                            <tr>
                                                                                <td rowspan="2" class="font14b" valign="top" width="33%" align="right">
                                                                                    请输入E-mail地址
                                                                                </td>
                                                                                <td valign="top" width="27%">
                                                                                    <input onblur="checkEmail();" id="userName" name="userName" runat="server" size="33"  value="" type="text">
                                                                                    <!--input name="EMail" type="text" size="33" onblur="checkEmail();"-->
                                                                                </td>
                                                                                <td rowspan="2" class="font9" valign="top" width="40%" align="left">
                                                                                    <div id="usernamePrompt">
                                                                                        请填写有效的Emai地址作为下次登录的用户名,同时我们也会给这个地址发送帐户信息、订单通知等</div>
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td class="font9" valign="top">
                                                                                    轻松获取免费邮箱：<a href="http://cn.mail.yahoo.com/" class="ablue" target="blank"> 雅虎</a>&nbsp;&nbsp;
                                                                                    <a href="http://mail.sina.com.cn/cgi-bin/register/regMember1.cgi" class="ablue" target="blank">
                                                                                        新浪</a>&nbsp;&nbsp; <a href="http://passport.sohu.com/web/signup.jsp?appid=1000&amp;ru=http://login.mail.sohu.com/reg/signup_success.jsp"
                                                                                            class="ablue" target="blank">搜狐</a>
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td class="font14b" align="right">
                                                                                    重新输入一遍
                                                                                </td>
                                                                                <td>
                                                                                    <input name="repeatUserName" id="repeatUserName" runat="server" size="33" value="" onblur="checkEmail2();" type="text">
                                                                                </td>
                                                                                <td>
                                                                                    &nbsp;
                                                                                </td>
                                                                            </tr>
                                                                            <tr align="center">
                                                                                <td colspan="3">
                                                                                    <span class="sans">
                                                                                        <hr size="1" width="85%" noshade="true">
                                                                                    </span>
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td class="font14b" align="right">
                                                                                    请输入姓名
                                                                                </td>
                                                                                <td>
                                                                                    <input name="nickName" size="19" id="nickName" runat="server" value="" onblur="checkFriendlyName();" type="text">
                                                                                </td>
                                                                                <td class="font9">
                                                                                    <div id="friendlyNamePrompt">
                                                                                        您希望我们怎样称呼您？</div>
                                                                                </td>
                                                                            </tr>
                                                                            <tr align="center">
                                                                                <td colspan="3">
                                                                                    <span class="sans">
                                                                                        <hr size="1" width="85%" noshade="true">
                                                                                    </span>
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td class="font14b" valign="top" align="right">
                                                                                    为保护您的帐户信息，请设置密码
                                                                                </td>
                                                                                <td valign="top">
                                                                                    <input name="passWord" id="passWord" runat="server" size="30" maxlength="16" onblur="checkPassword();" type="password">
                                                                                </td>
                                                                                <td class="font9" valign="top" align="left">
                                                                                    <div id="passwordPrompt">
                                                                                        密码要求由英文字母 (a-z大小写均可)、阿拉伯数字 (0-9) 组成且长度为6-16位字符</div>
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td class="font14b" valign="top" align="right">
                                                                                    请再次确认
                                                                                </td>
                                                                                <td valign="top">
                                                                                    <input name="validatePwd"  id="validatePwd" runat="server" size="30" maxlength="16" onblur="checkPassword2();" type="password">
                                                                                </td>
                                                                                <td>
                                                                                    &nbsp;
                                                                                </td>
                                                                            </tr>
                                                                            <tr align="center">
                                                                                <td colspan="3">
                                                                                    <span class="sans">
                                                                                        <hr size="1" width="85%" noshade="true">
                                                                                    </span>
                                                                                </td>
                                                                            </tr>
                                                                            <tr valign="top">
                                                                                <td class="font14b" valign="top" align="right">
                                                                                    为了增加安全性，请输入验证码
                                                                                </td>
                                                                                <td>
                                                                                    <input id="verifyCode" name="verifyCode" runat="server" size="30" maxlength="64" type="text" width="130">                                                                                   
                                                                                </td>
                                                                                <td align="left">                                                                                   
                                                                                    <img id="imgVerify" src="VerifyCode.aspx?" alt="看不清？点击更换" onclick="this.src=this.src+'?'" />                                                                                  

                                                                                </td>
                                                                            </tr>
                                                                             <tr>
                                                                                <td>
                                                                                    &nbsp;
                                                                                </td>
                                                                                <td colspan="2">
                                                                                    &nbsp;
                                                                                </td>
                                                                            </tr>
                                                                            <tr valign="top">
                                                                                <td class="font14b" valign="top" align="center" colspan="3">
                                                                                      <asp:Label ID="Msg" runat="server" ForeColor="Red"></asp:Label>
                                                                                </td>  
                                                                            </tr>
                                                                            <tr>
                                                                                <td>
                                                                                    &nbsp;
                                                                                </td>
                                                                                <td colspan="2">
                                                                                    &nbsp;
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td>
                                                                                    &nbsp;
                                                                                </td>
                                                                                <td colspan="2">                                                                                
                                                                                    <asp:ImageButton runat="server"  alt="完成"  id="FinsihedReg"
                                                                                        ImageUrl="../images/az-finish.gif" onclick="FinsihedReg_Click"  /> 
                                                                                </td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>                                                   
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
        </tbody>
    </table>
    <table width="85%" align="center" bgcolor="#ddddcc" border="0" cellpadding="0" cellspacing="0">
        <tbody>
            <tr valign="bottom">
                <td align="left" bgcolor="#ddddcc" height="10">
                    <img src="loginApplication_files/az-tan-bottom-left-round-corner.gif" width="10"
                        border="0" height="10">
                </td>
                <td align="right" bgcolor="#ddddcc" height="10">
                    <img src="loginApplication_files/az-tan-bottom-right-round-corner.gif" width="10"
                        border="0" height="10">
                </td>
            </tr>
        </tbody>
    </table>
    <p>
        &nbsp;</p>
    <!--this is content end-->
</asp:Content>
